import { getPortalSiteReq, queryKaptchaReq, queryLoginReq, queryLoginAuth } from './api'

export default {
  namespace: 'login',
  state: {},

  effects: {
    * queryKaptcha({ params, cb }, { call, put }) {
      const res = yield call(queryKaptchaReq, params)
      if (res && cb) {
        cb(res)
      }
    },

    * queryLogin({ params, cb }, { call, put }) {
      const res = yield call(queryLoginReq, params)
      if (res && cb) {
        cb(res)
      }
    },

    * getPortalSite({ params, cb }, { call, put }) {
      const res = yield call(getPortalSiteReq, params)
      if (res && cb) {
        cb(res)
      }
    },

    * queryLoginAuth({ params, cb }, { call, put }) {
      const res = yield call(queryLoginAuth, params)
      if (res && cb) {
        cb(res)
      }
    },
  },
  reducers: {},
}
